<div class="tpl-left-nav tpl-left-nav-hover">
    <div class="tpl-left-nav-title">
        Amaze UI 列表
    </div>
    <div class="tpl-left-nav-list">
        <ul class="tpl-left-nav-menu">
            <li class="tpl-left-nav-item">
                <a href="javascript:void(0)" onClick="javascript:openItem('welcome|Index');" class="nav-link active">
                    <i class="am-icon-home"></i>
                    <span>首页</span>
                </a>
            </li>
            {foreach $menu as $v}
            <li class="tpl-left-nav-item">
                {if condition="!empty($v['child'])"}
                    <a href="javascript:;" class="nav-link tpl-left-nav-link-list">
                    {else/}
                    <a href="javascript:void(0)" data-param="{$v.act}|{$v.op}" class="nav-link tpl-left-nav-link-list">
                        {/if}
                        <i class="am-icon-wpforms"></i>
                        <span>{$v.name}</span>
                        {if condition="!empty($v['child'])"}
                        <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right tpl-left-nav-more-ico-rotate"></i>
                        {/if}
                    </a>
                    {if condition="!empty($v['child'])"}
                    <ul class="tpl-left-nav-sub-menu sub-menu">
                        <li>
                            {foreach $v['child'] as $vv}
                            <a href="javascript:void(0)" data-param="{$vv.act}|{$vv.op}">
                                <i class="am-icon-angle-right"></i>
                                <span>{$vv.name}</span>
                            </a>
                            {/foreach}
                        </li>
                    </ul>
                    {/if}
            </li>
            {/foreach}
        </ul>
    </div>
</div>
<script>
    // 侧边导航三级级菜单点击
    $('.sub-menu').find('a').click(function(){
        openItem($(this).attr('data-param'));
    });
    // 点击菜单，iframe页面跳转
    function openItem(param) {
        //alert(param);
        //return false;
        //console.log(param);
        $('.sub-menu').find('li').removeClass('active');
        data_str = param.split('|');

        $this = $('div[id^="admincpNavTabs_"]').find('a[data-param="' + param + '"]');
        if ($('.admincp-container').hasClass('unfold')) {
            $('.sub-menu').hide();
            $this.parents('dd:first').show();
        }
        $('div[id^="admincpNavTabs_"]').hide().find('dl').removeClass('active');
        $('li[data-param="' + data_str[1] + '"]').addClass('active');
        //$('li[data-param="' + data_str[0] + '"]').addClass('active');
        $this.parent().addClass('active').parents('dl:first').addClass('active').parents('div:first').show();
        //$('#workspace').attr('src','/index.php?m=Admin&c=' + data_str[1] + '&a=' + data_str[0]);
        $('#workspace').attr('src','/index.php/Admin/' + data_str[1] + '/' + data_str[0]);
        $.cookie('workspaceParam', data_str[0] + '|' + data_str[1], { expires: 1 ,path:"/"});
    }
</script>